cmake_minimum_required(VERSION 2.8)

SET(PRJ_NAME 				mssql-samples)
SET(PRJ_ROOTDIR				${CMAKE_CURRENT_SOURCE_DIR} )
SET(THRPOOL_LIBDIR			/home/jinquan/c/libcurl/libstpool/obj)

PROJECT(${PRJ_NAME} 		C CXX)

MESSAGE(STATUS "Building freetds demo routine.")

INCLUDE_DIRECTORIES( 
	"${PRJ_ROOTDIR}"
	"${THRPOOL_LIBDIR}/include/stpool"					#libstpool
	"/usr/include/glib-2.0"
	"/usr/lib64/glib-2.0/include"
)

LINK_DIRECTORIES(
	"${THRPOOL_LIBDIR}/lib"								#libstpool
	"/usr/lib64"										#glib-2.0, libsybdb
)
	
	SET(cflags	-std=gnu99)
	ADD_DEFINITIONS(${cflags})

	SET(SRCLIST_insert
		${PRJ_ROOTDIR}/mssql_common.c
		${PRJ_ROOTDIR}/func_insertDat.c
	)

	SET(SRCLIST_colname
		${PRJ_ROOTDIR}/mssql_common.c
		${PRJ_ROOTDIR}/func_getColumnName.c
	)

	ADD_EXECUTABLE(mssqltool   ${SRCLIST_insert} )
	ADD_EXECUTABLE(colname  ${SRCLIST_colname} )
	
	TARGET_LINK_LIBRARIES(mssqltool 
	-ldl -lstdc++ -lm -lpthread -lglib-2.0 
	libstpool.a libmsglog.a -lsybdb)
	
	TARGET_LINK_LIBRARIES( colname
	-ldl -lstdc++ -lm -lpthread -lglib-2.0 
	libstpool.a libmsglog.a -lsybdb)